NOTE: This Technical Q&A has been retired. Please see the Technical Q&As page for current documentation.

Technical Q&A QD49
Copybits Bus Error with Offscreen GWorld


Q: I'm attempting to CopyBits an image from a window to an offscreen GWorld, and I'm getting a Bus Error on some machines but not others.

A: Your window is partially off the bottom of the screen, and CopyBits is attempting to read pixels below the bottom of the PixMap. In some cases, the access is going beyond the video RAM into unmapped memory space, causing a Bus Error.

Native QuickDraw fixes this problem by comparing the source rectangle to the source PixMap's bounds rect, but most 68K versions of QuickDraw do not check the source rectangle. For best results, constrain your source rectangle to the limits of the screen. Note that you can't always rely on the window having useful information, since it might be obscured by other windows, or it might have been written to by another piece of code (e.g., games that write directly to the screen, extensions, etc).

[Nov 17 1997]


Developer Documentation | Technical Notes | Development Kits | Sample Code